package com.bawei.yangzongcai___chenmei.BlankFragment.Blanck1;


import android.animation.AnimatorSet;
import android.animation.ObjectAnimator;
import android.view.View;
import android.widget.Button;
import android.widget.ImageView;

import com.bawei.yangzongcai___chenmei.MVC.BsaeFragment;
import com.bawei.yangzongcai___chenmei.R;


public class BlankFragmentZhu5 extends BsaeFragment implements View.OnClickListener {

    ObjectAnimator objectAnimator;
    private Button zhu5Jianbian;
    private Button zhu5Xuanzhaun;
    private Button zhu5Suofang;
    private Button zhu5Yidong;
    private Button zhu5Hecheng;
    private ImageView zhu5Img;
    ObjectAnimator objectAnimator1;
    ObjectAnimator objectAnimator2;
    ObjectAnimator objectAnimator3;

    @Override
    public int bandLayout() {
        return R.layout.fragment_blank_fragment_zhu5;
    }

    @Override
    public void initView() {

        zhu5Jianbian = findbandid(R.id.zhu5_jianbian);
        zhu5Xuanzhaun = findbandid(R.id.zhu5_xuanzhaun);
        zhu5Suofang = findbandid(R.id.zhu5_suofang);
        zhu5Yidong = findbandid(R.id.zhu5_yidong);
        zhu5Hecheng = findbandid(R.id.zhu5_hecheng);
        zhu5Img = findbandid(R.id.zhu5_img);
        zhu5Jianbian.setOnClickListener(this);
        zhu5Xuanzhaun .setOnClickListener(this);
        zhu5Suofang  .setOnClickListener(this);
        zhu5Yidong  .setOnClickListener(this);
        zhu5Hecheng .setOnClickListener(this);
        zhu5Img.setOnClickListener(this);
    }

    @Override
    public void initDate() {

    }

    @Override
    public void onClick(View v) {
        switch (v.getId()) {
            case R.id.zhu5_jianbian:
                objectAnimator = ObjectAnimator.ofFloat(zhu5Img, "alpha", 1f, 0f,1f);
                objectAnimator.setDuration(5000);
                objectAnimator.setRepeatCount(3);
                objectAnimator.start();
                break;
            case R.id.zhu5_xuanzhaun:
                objectAnimator = ObjectAnimator.ofFloat(zhu5Img,"rotation",360f,-360f,180f,-180f,180f,360f);
                objectAnimator.setDuration(5000);
                objectAnimator.setRepeatCount(3);
                objectAnimator.start();
                break;
            case R.id.zhu5_suofang:
                objectAnimator = ObjectAnimator.ofFloat(zhu5Img,"scaleX",2f,1f,3f,2f,1f);
                objectAnimator.setDuration(5000);
                objectAnimator.setRepeatCount(3);
                objectAnimator.start();
                break;
            case R.id.zhu5_yidong:
                objectAnimator = ObjectAnimator.ofFloat(zhu5Img,"translationX",0f,60f,0f,30f,0f,70f,0f);
                objectAnimator.setDuration(5000);
                objectAnimator.setRepeatCount(3);
                objectAnimator.start();
                break;
            case R.id.zhu5_hecheng:
                objectAnimator1 = ObjectAnimator.ofFloat(zhu5Img,"translationX",0f,60f,0f,60f,0f,60f,0f,60f,0f);
                objectAnimator2 = ObjectAnimator.ofFloat(zhu5Img,"translationY",0f,60f,0f,60f,0f,60f,0f,60f,0f);
                objectAnimator3 = ObjectAnimator.ofFloat(zhu5Img,"alpha",1f,0f,2f,0f,1f);
                AnimatorSet animatorSet = new AnimatorSet();
                animatorSet.play(objectAnimator1).with(objectAnimator2).before(objectAnimator3);
                animatorSet.setDuration(5000);
                animatorSet.start();

                break;
        }
    }
}
